<html>
          <head>
            <title>Letter Count Analysis</title>
            <script language='javascript' src='Charts/FusionCharts/FusionCharts.js'></script>
          </head>
<body>

<?PHP include("functions.php"); include('Charts/Class/FusionCharts_Gen.php'); //include ("chart.php");


if ($_POST['text1']){// && $_POST['text2']) {
	//compText($_POST['text1'], $_POST['text2']);
	compText($_POST['text1']);
	
	
       # Include FusionCharts PHP Class
           

       # Create Column3D chart Object 
           $FC = new FusionCharts("Column3D","600","350"); 
          # set the relative path of the SWF file
          $FC->setSWFPath("Charts/FusionCharts/");
          #  Set chart attributes
          $strParam="caption=Letter Count Analysis;xAxisName=Letter;yAxisName=Count;numberPrefix=";
          $FC->setChartParams($strParam);
          # add chart values and  category names

        //Strip the string
        $str = $_POST['text1'];
		$new_string = strtolower(ereg_replace("[^A-Za-z]", "", $str ));
	
		foreach (count_chars($new_string, 1) as $i => $val) {
			$tmp = "label=".chr($i);
			$FC->addChartData($val,$tmp);
   			//echo "There were $val instance(s) of \"" , chr($i) , "\" in the string.\n";
		};
    # Render Chart 
    $FC->renderChart();
        
	
};



?>

<?PHP
	
	
?>

</br>
</br>
<a href="index.php">Go Back</a>
</body>
</html>